package com.electronic.exception;


import lombok.Getter;

import javax.servlet.http.HttpServletResponse;

/**
 * @Author: IFCA
 * @Description: 返回码定义
 */

@Getter
public enum ResultCode {
    /**
     * 成功
     */
    SUCC(200, "", "成功"),
    /**
     * 失败
     */
    FAIL(HttpServletResponse.SC_BAD_REQUEST, "", "失败"),

    // 文件相关错误码

    ERROR_PARAM(HttpServletResponse.SC_BAD_REQUEST, "028-01-P-001", "参数错误"),
    ERROR_PARAM_EMPTY(HttpServletResponse.SC_BAD_REQUEST,"028-01-P-002", "参数不能为空"),
    ERROR_PARAM_TYPE(HttpServletResponse.SC_BAD_REQUEST, "028-01-P-003", "参数类型错误"),
    ERROR_PARAM_LENGTH(HttpServletResponse.SC_BAD_REQUEST, "028-01-P-004", "参数长度错误"),
    ERROR_PARAM_VALUE(HttpServletResponse.SC_BAD_REQUEST, "028-01-P-005","参数值错误"),
    ERROR_FILE_EXT(HttpServletResponse.SC_BAD_REQUEST, "028-01-P-006", "文件扩展名错误"),
    ERROR_FILE_EXT_NOT_ALLOWED(HttpServletResponse.SC_BAD_REQUEST, "028-01-P-007", "文件扩展名不被允许"),
    ERROR_FILE(HttpServletResponse.SC_BAD_REQUEST, "028-01-B-001", "文件错误"),
    ERROR_FILE_NOT_FOUND(HttpServletResponse.SC_BAD_REQUEST, "028-01-B-002", "文件不存在"),
    ERROR_FILE_PARSER(HttpServletResponse.SC_BAD_REQUEST, "028-01-B-003", "文件解析出错"),
    ERROR_FILE_TRANSFER(HttpServletResponse.SC_BAD_REQUEST, "028-01-B-004","文件转换出错"),
    ERROR_FILE_FORBIDDEN(HttpServletResponse.SC_BAD_REQUEST, "028-01-B-005", "文件禁止访问"),


    // 签章相关错误码
    ERROR_SIGNATURE_QRCODE(HttpServletResponse.SC_BAD_REQUEST, "028-02-B-001", "获取签章二维码失败"),
    ERROR_SIGNATURE_QRCODE_STATUS(HttpServletResponse.SC_BAD_REQUEST, "028-02-B-002", "获取签章二维码状态失败"),
    ERROR_SIGNATURE_QRCODE_USER(HttpServletResponse.SC_BAD_REQUEST, "028-02-B-003", "获取签章二维码扫码用户信息失败"),
    ERROR_USER_SEALS(HttpServletResponse.SC_BAD_REQUEST, "028-02-B-004", "未获取到用户印章列表"),
    ERROR_USER_SEALS_PHOTO(HttpServletResponse.SC_BAD_REQUEST, "028-02-B-005", "计算扫码用户印章列表印章图片异常"),
    ERROR_CLOSE_SIGNATURE(HttpServletResponse.SC_BAD_REQUEST, "028-02-B-006", "调用中招关闭签章失败"),
    ERROR_SIGNATURE_FAIL_USER_NOT_SCAN(HttpServletResponse.SC_BAD_REQUEST, "028-02-B-007", "用户未完成扫码，无法进行签章"),
    ERROR_USER_NOT(HttpServletResponse.SC_BAD_REQUEST, "028-02-B-008", "未获取到用户信息，无法执行退出签章"),
    ERROR_SPECTRE_SEAL_SIGNATURE_NOT(HttpServletResponse.SC_BAD_REQUEST, "028-02-B-009", "组合外部签名异常"),
    ERROR_SIGNATURE_CONFIG(HttpServletResponse.SC_BAD_REQUEST, "028-02-B-010", "执行签署失败"),
    ERROR_PAGE(HttpServletResponse.SC_BAD_REQUEST, "028-02-B-011", "页码无效"),
    ERROR_PDF_WIDTH(HttpServletResponse.SC_BAD_REQUEST, "028-02-B-012", "PDF矩形宽度不满足要求，小于指定值"),
    ERROR_PAGE_HEIGHT(HttpServletResponse.SC_BAD_REQUEST, "028-02-B-013", "PDF矩形高度不满足要求，小于指定值"),
    ERROR_RECTANGLE(HttpServletResponse.SC_BAD_REQUEST, "028-02-B-014", "未获取骑缝章签名外观对象"),
    ERROR_USER_LOGIN_EXIT(HttpServletResponse.SC_BAD_REQUEST, "028-02-B-015", "用户已退出签章，无法获取签名值，请重新扫码"),
    ERROR_CERT_ALG_NOT_FOUND(HttpServletResponse.SC_BAD_REQUEST, "028-02-B-016", "无法确定证书类型"),
    ERROR_PDF_KEY_WORD(HttpServletResponse.SC_BAD_REQUEST, "028-02-B-017", "PDF未包含指定关键字"),
    ERROR_PDF_PAGE(HttpServletResponse.SC_BAD_REQUEST, "028-02-B-018", "指定页码超出PDF文件总页"),
    ERROR_SIGNATURE(HttpServletResponse.SC_BAD_REQUEST, "028-02-B-019", "执行签章异常"),
    ERROR_SIGNATURE_PHOTO(HttpServletResponse.SC_BAD_REQUEST, "028-02-B-020", "APP印章图片大小超出指定范围"),


//    ERROR_SIGNATURE_SCAN_FIRST(HttpServletResponse.SC_BAD_REQUEST, "028-02-B-002", "当前请求无效，请先进行签章扫码"),
//    ERROR_SIGNATURE_DUPLICATE_TRANSACTION_ID(HttpServletResponse.SC_BAD_REQUEST, "028-02-B-003", "业务唯一流水号已存在"),
//    ERROR_SIGNATURE_CERT_VALID(HttpServletResponse.SC_BAD_REQUEST, "028-02-B-004", "签章者证书无效"),
//    ERROR_SIGNATURE_SEAL_LIST_NOT_FOUND(HttpServletResponse.SC_BAD_REQUEST, "028-02-B-005", "未获取到签章者电子印章"),
//
//    ERROR_SIGNATURE_CERT_SEAL_NOT_MATCH(HttpServletResponse.SC_BAD_REQUEST, "028-02-B-007", "验证签章者证书与电子印章匹配性失败"),
//    ERROR_SIGNATURE_NOT_SCAN_NO_NEED_EXIT(HttpServletResponse.SC_BAD_REQUEST, "028-02-B-008", "用户未完成扫码，无需退出"),
//    ERROR_CA_SHARE_SDK_FAIL(HttpServletResponse.SC_BAD_REQUEST, "028-02-B-009", "CA共享SDK数据异常"),

    // 验签相关错误码

    ERROR_VERIFY_SIGNATURE_FORMAT_DATA(HttpServletResponse.SC_BAD_REQUEST, "028-03-B-001", "电子签章数据格式无效"),
    ERROR_VERIFY_SIGNATURE_FAIL(HttpServletResponse.SC_BAD_REQUEST, "028-03-B-002", "验章失败"),
    ERROR_VERIFY_CERT_CHAIN(HttpServletResponse.SC_BAD_REQUEST, "028-03-B-003", "读取证书链文件失败"),

    // 撤章相关错误码
//    ERROR_REVOKE_SIGNATURE_NOT_FOUND(HttpServletResponse.SC_BAD_REQUEST, "028-04-B-001", "撤章记录不存在"),
    ERROR_REVOKE_SIGNATURE_QRCODE(HttpServletResponse.SC_BAD_REQUEST, "028-04-B-001", "获取撤章二维码失败"),
    ERROR_REVOKE_SIGNATURE_QRCODE_STATUS(HttpServletResponse.SC_BAD_REQUEST, "028-04-B-002", "获取撤章二维码扫码状态失败"),
    ERROR_REVOKE_SIGNATURE_VERIFY_CERT(HttpServletResponse.SC_BAD_REQUEST, "028-04-B-003", "校验撤章二维码证书序列号失败"),
    ERROR_REVOKE_SIGNATURE_USER_NOT_ALLOW(HttpServletResponse.SC_BAD_REQUEST, "028-04-B-004", "撤章用户权限校验失败"),
    ERROR_REVOKE_SIGNATURE_USER_NOT_SCAN(HttpServletResponse.SC_BAD_REQUEST, "028-04-B-005", "用户未完成扫码，无法进行撤章");



    /**
     * 状 态 码
     */
    private final int code;

    /**
     * 携带消息
     */
    private final String message;

    /**
     * 错误码
     */
    private final String errorCode;

    /**
     * 构造方法
     */
    ResultCode(int code, String errorCode, String message) {

        this.code = code;

        this.message = message;

        this.errorCode = errorCode;
    }
}
